package com.example.test.util;

import com.example.test.model.Student;
import org.apache.ibatis.session.RowBounds;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

public class MyBatisPagination {
    public static void main(String[] args) {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        SqlSessionTemplate sqlSessionTemplate = (SqlSessionTemplate) applicationContext.getBean("SqlSessionTemplate");

        int currenPage = 3;
        RowBounds rowBounds = new RowBounds(10*currenPage,10);

        List<Student> students = sqlSessionTemplate.selectList("students.queryAll");
        System.out.println(students.size());
        System.out.println(Integer.MAX_VALUE);
    }
}
